<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class JudicialOfficersInfoResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return  [
            'id' => (integer)$this->id,
            'users_id' => (integer)$this->users_id,
            'name' => (string)$this->name,
            'code' => (string)$this->code,
            'tel' => (string)$this->tel,
            'judicial_name'=> (string)$this->judicial_name,
            'username' => (string)$this->user?$this->user->username:'',
            'password' => (string)$this->user?$this->user->password:'',
        ];
    }
}
